package com.appstore.servlet;

import javax.naming.NamingException;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;

import com.appstore.dao.impl.AdministratorDaoimpl;
import com.appstore.dao.impl.ApplicationDaoImpl;
import com.appstore.dao.impl.CommentDaoImpl;
import com.appstore.util.ConnectionManager;

public class DatasourceInitiation extends HttpServlet {

	@Override
	public void init(ServletConfig config) throws ServletException {
		super.init(config);
		// initiate ConnectionManager
		try {
			ConnectionManager.createInstance();
		} catch (NamingException e) {
			throw new ServletException(
			        "There is a error while creating datasource", e);
		}
		// initiate DAO
		ApplicationDaoImpl.createInstatce();
		AdministratorDaoimpl.createInstatce();
		CommentDaoImpl.createInstatce();
	}

}
